#! /usr/bin/bash
# Copyright (c) 2025, Shanghai Iluvatar CoreX Semiconductor Co., Ltd.
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#  * Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#  * Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#  * Neither the name of NVIDIA CORPORATION nor the names of its
#    contributors may be used to endorse or promote products derived
#    from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

export CUDA_HOME=/opt/sw_home/local/cuda
export IGIE_HOME=/opt/apps/igie
export PYTHONPATH=/opt/apps/local/lib/python3/dist-packages:/usr/local/lib/python3.6/dist-packages
export PYTHONPATH=${IGIE_HOME}/python:${PYTHONPATH}
export UMD_NOPSAFTERDMA=20

TRITON_ROOT=`pwd`

# ====================== basic models ==================
function run_resnet50() {

    python3 ${TRITON_ROOT}/src/igie_backend/examples/clients/resnet50.py \
            --model-path ${TRITON_ROOT}/models/resnet50/1/ResNet50_batchsize_16_fp16.so \
            --model-name resnet50 \
            --input-name input \
            --output-name output \
            --batch-size 16 \
            --data-path ${TRITON_ROOT}/datasets/imagenet/val/n01440764

}

function run_clip() {

    python3 ${TRITON_ROOT}/src/igie_backend/examples/clients/clip.py \
            --model-path ${TRITON_ROOT}/models/clip/1/clip_opt_batchsize_32_fp16.so \
            --model-name clip \
            --batch-size 32 \
            --checkpoint openai/clip-vit-base-patch32 \
            --data-path /data/datasets/imagenet/val

}
# ====================== end of basic models ==================

function run_concurrent_model() {

    python3 ${TRITON_ROOT}/src/igie_backend/examples/clients/concurrent_model.py \
            --model-path ${TRITON_ROOT}/models/resnet50/1/ResNet50_batchsize_16_fp16.so \
            --threading-num 10 \
            --model-name resnet50 \
            --input-name input \
            --output-name output \
            --batch-size 16 \
            --data-path ${TRITON_ROOT}/datasets/imagenet/val/n01440764

}


function run_dynamic_batching_model() {

    python3 ${TRITON_ROOT}/src/igie_backend/examples/clients/dynamic_batching.py \

}

# run_resnet50
# run_concurrent_model
# run_dynamic_batching_model
